﻿<UserControl x:Class="RIA.NTiersApp.Views.CustomerUI.AddressList"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"   xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices" xmlns:my="clr-namespace:RIA.DAL;assembly=RIA.ServicesLibrary" xmlns:my1="clr-namespace:RIA.ServicesLibrary.Web.Services;assembly=RIA.ServicesLibrary" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">
    
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel>
            <Button x:Name="btnAddNew" Content="Add" Width="100" HorizontalAlignment="Right" Click="btnAddNew_Click"></Button>
        </StackPanel>
        <sdk:DataGrid AutoGenerateColumns="False"  
                      HorizontalAlignment="Left" 
                      Margin="5"
                      ItemsSource="{Binding Path=Customer.CustomerAddresses}"
                      Name="addressDataGrid" 
                      RowDetailsVisibilityMode="VisibleWhenSelected" 
                      VerticalAlignment="Top"
                      Grid.Row="1"
                      >
            <sdk:DataGrid.Columns>
                <sdk:DataGridTextColumn x:Name="addressLine1Column" Binding="{Binding Path=Address.AddressLine1,Mode=TwoWay}" Header="Address Line 1" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="addressLine2Column" Binding="{Binding Path=Address.AddressLine2,Mode=TwoWay}" Header="Address Line 2" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="cityColumn" Binding="{Binding Path=Address.City, Mode=TwoWay}" Header="City" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="countryRegionColumn" Binding="{Binding Path=Address.CountryRegion, Mode=TwoWay}" Header="Country Region" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="postalCodeColumn" Binding="{Binding Path=Address.PostalCode, Mode=TwoWay}" Header="Postal Code" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="stateProvinceColumn" Binding="{Binding Path=Address.StateProvince, Mode=TwoWay}" Header="State Province" Width="SizeToHeader" />
                <sdk:DataGridTemplateColumn>
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Content="Delete" Click="DeleteButton_Click" />
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>
    </Grid>
</UserControl>
